# -*- coding: utf-8 -*-

from odoo import models, fields, api


class PriceListProductPricelist(models.Model):
    _inherit = 'product.pricelist'

    def import_price_excel(self):
        action = self.env.ref('yifeng_custom.product_pricelist_item_action').read()[0]
        action['context'] = {'default_pricelist_id': self.id}
        action['domain'] = [('pricelist_id', '=', self.id)]
        return action

    class PriceListProductPricelistItem(models.Model):
        _inherit = "product.pricelist.item"

        prduct_state = fields.Many2many(comodel_name='product.state', related='product_tmpl_id.product_satae', string='狀態')
        product_type_line = fields.Many2one(comodel_name='product.type.line', related='product_tmpl_id.product_type_line', string='產品種類')